const {Article} = require('../../model/article')
//导入分页模块
const pagination = require('mongoose-sex-page')

module.exports = async(req ,res)=>{  

    const page = req.query.page;
   //从数据库中查找文章
    let  result  = await pagination(Article).page(page).size(4).display(3).find().populate('author').exec();

   // 渲染博客首页并传递数据 
    res.render('home/default.html',{
        result:result

    })
}